﻿#region Using directives

using System;
using System.Collections;
using System.Data;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.MD.Runtime.Implement;

#endregion

namespace DeliverRef
{
	[Serializable]
	public partial class DeliverRefModel : UIModel
	{
		#region Constructor
		public DeliverRefModel() : base("DeliverRef")
		{
			InitClass();
			this.SetResourceInfo("e7686aaf-26a4-4886-abf2-0b046253fe6e");
            try{
			    AfterInitModel();
            }catch(Exception exception){
              IUIModel model = this;
		      this.ErrorMessage.SetErrorMessage(ref model,exception);
			}
		}

		//just for Clone 
		private DeliverRefModel(bool isInit) : base("DeliverRef")
		{}
		protected override IUIModel CreateCloneInstance()
		{
			return new DeliverRefModel(false);
		}
		#endregion
		#region member
		#region views
		private cRefView viewcRef;			
		#endregion
		
		#region links
		#endregion
		
		#region properties
		#endregion
		#endregion

		#region property
		public cRefView cRef
		{
			get { return (cRefView)this["cRef"]; }
		}
		
		#region RealViews
		#endregion
		
	
		#endregion

		#region function
		private void InitClass()
		{
			this.viewcRef = new cRefView(this);
			this.viewcRef.SetResourceInfo("a3f5c664-66ac-4a3b-ac64-b54a41104053");
			this.Views.Add(this.viewcRef);			

			
		}

		public override string AssemblyName
		{
			get { return "UFIDA.U9.Cust.U9Demo.DeliverUI"; }
		}
		
		#endregion
		private void OnValidate_DefualtImpl()
    {
    }

	}


	[Serializable]
	public partial class cRefView : UIView
	{
		#region Constructor
		public cRefView(IUIModel model) : base(model,"cRef","UFIDA.U9.Cust.U9Demo.DeliverBE.Delivery", true)
		{
			InitClass();
		}
		//构造空实例,不进行初始化.目前为Clone使用.
		private cRefView():base(null,"cRef","UFIDA.U9.Cust.U9Demo.DeliverBE.Delivery", true)
		{
		}
		protected override IUIView CreateCloneInstance()
		{
			return new cRefView();
		}
		#endregion

		#region fiels property filter
		public IUIField FieldID
		{
			get { return this.Fields["ID"]; }
		}
		public IUIField FieldDocNo
		{
			get { return this.Fields["DocNo"]; }
		}
		public IUIField FieldStatus
		{
			get { return this.Fields["Status"]; }
		}
		public IUIField FieldBusinessDate
		{
			get { return this.Fields["BusinessDate"]; }
		}
		public IUIField FieldSupplier_Code
		{
			get { return this.Fields["Supplier_Code"]; }
		}
		public IUIField FieldSupplier_Name
		{
			get { return this.Fields["Supplier_Name"]; }
		}


		[Obsolete("请使用CurrentFilter属性，这个方法有可能会导致强弱类型转换出错")]
		public cRefDefaultFilterFilter DefaultFilter
		{
			get { return (cRefDefaultFilterFilter)this.CurrentFilter; }
		}
		#endregion

		#region Init
		private void InitClass()
		{
			UIModelRuntimeFactory.AddNewUIField(this,"ID", typeof(Int64), false,"","System.Int64", "ID", true,true, false, "",false,(UIFieldType)1,"ba391065-6c27-4c82-acc8-b52b1c93a910","19bc51db-443d-4c92-b4ed-3c7c195ff3c5");
			UIModelRuntimeFactory.AddNewUIField(this,"DocNo", typeof(String), false,"","System.String", "DocNo", true,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","a87abb9d-7296-48e3-9daa-e4fb3e61b51b");
			UIModelRuntimeFactory.AddNewUIField(this,"Status", typeof(Int32), true,"","UFIDA.U9.Cust.U9Demo.DeliverBE.StatusEnum", "Status", true,true, false, "",false,(UIFieldType)2,"5595bf0b-9b29-4137-a7df-dd798aa1edb3","8c232e97-fb5f-49d6-ba51-0d6890f71b18");
			UIModelRuntimeFactory.AddNewUIField(this,"BusinessDate", typeof(DateTime), false,"","System.Date", "BusinessDate", true,true, false, "",false,(UIFieldType)1,"c9e6bc50-2e39-4f27-9519-da0c7859d37e","e0a2df54-9928-44c4-aa5d-e1b989609122");
			UIModelRuntimeFactory.AddNewUIField(this,"Supplier_Code", typeof(String), false,"","System.String", "Supplier.Code", false,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","c8343a6d-8fb2-4b6b-b0fe-6c24ce96de00");
			UIModelRuntimeFactory.AddNewUIField(this,"Supplier_Name", typeof(String), true,"","System.String", "Supplier.Name", false,true, false, "",true,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","a13dd9a5-cb1e-43e4-a05f-703a53463193");


			this.CurrentFilter = new cRefDefaultFilterFilter(this);
		}
		#endregion
		
		#region override method
		protected override IUIRecord BuildNewRecord(IUIRecordBuilder builder)
		{
			return new cRefRecord(builder);
		}
		#endregion

		#region new method
		public new cRefRecord FocusedRecord
		{
			get { return (cRefRecord)base.FocusedRecord ; }
			set { base.FocusedRecord = value ; }
		}
		public new cRefRecord AddNewUIRecord()
		{	
			return (cRefRecord)base.AddNewUIRecord();
		}
		public new cRefRecord NewUIRecord()
		{	
			return (cRefRecord)base.NewUIRecord();
		}
		#endregion 

	}

	[Serializable]
	public class cRefRecord : UIRecord
	{
		#region Constructor
		public cRefRecord(IUIRecordBuilder builder):base(builder)
		{
		}
		private cRefView uiviewcRef
		{
			get { return (cRefView)this.ContainerView; }
		}
		protected override IUIRecord CreateCloneInstance(IUIRecordBuilder builder)
		{
			return new cRefRecord(builder);
		}
		#endregion

		#region property
		
		
		public  Int64 ID
		{
			get{
				//object value = this[this.uiviewcRef.FieldID] ;
				//return (Int64)value;
				return GetValue<Int64>(this.uiviewcRef.FieldID);
			}
			set{
				this[this.uiviewcRef.FieldID] = value;
			}
		}
		
		
		public  String DocNo
		{
			get{
				//object value = this[this.uiviewcRef.FieldDocNo] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldDocNo);
			}
			set{
				this[this.uiviewcRef.FieldDocNo] = value;
			}
		}
		
		
		public  Int32? Status
		{
			get{
				//object value = this[this.uiviewcRef.FieldStatus] ;
				//return (Int32?)value;
				return GetValue<Int32?>(this.uiviewcRef.FieldStatus);
			}
			set{
				this[this.uiviewcRef.FieldStatus] = value;
			}
		}
		
		
		public  DateTime BusinessDate
		{
			get{
				//object value = this[this.uiviewcRef.FieldBusinessDate] ;
				//return (DateTime)value;
				return GetValue<DateTime>(this.uiviewcRef.FieldBusinessDate);
			}
			set{
				this[this.uiviewcRef.FieldBusinessDate] = value;
			}
		}
		
		
		public  String Supplier_Code
		{
			get{
				//object value = this[this.uiviewcRef.FieldSupplier_Code] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldSupplier_Code);
			}
			set{
				this[this.uiviewcRef.FieldSupplier_Code] = value;
			}
		}
		
		
		public  String Supplier_Name
		{
			get{
				//object value = this[this.uiviewcRef.FieldSupplier_Name] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldSupplier_Name);
			}
			set{
				this[this.uiviewcRef.FieldSupplier_Name] = value;
			}
		}
		#endregion
	}
	
	[Serializable]
	public class cRefDefaultFilterFilter : UIFilter
	{
		#region Constructor
		public cRefDefaultFilterFilter(IUIView view) 
			: base("DefaultFilter",view,@"Org.ID=#Context.OrgID#",@"")
		{
			InitClass();
		}
		//for Clone Constructor
		private cRefDefaultFilterFilter()
			: base("DefaultFilter",null,"","")
		{}
		protected override IUIFilter CreateCloneInstance()
		{
			return new cRefDefaultFilterFilter();
		}
		#endregion

		#region property
		#endregion
		
		#region function
		private void InitClass()
		{
		}
		#endregion

	}



}